package Framework
{
	import flash.display.Sprite;
	import flash.display.Stage;
	import Games.PumpGame.Entities.Room;
	/**
	 * ...
	 * @author Menno
	 */
	public class GuiManager 
	{
		private var guiList:Array;
		private var stage:Sprite;
		
		public function GuiManager(stage:Sprite) 
		{
			guiList = new Array();
			this.stage = stage;
		}
		
		public function addGuiObject(element:BaseGui):void
		{
			guiList.push(element);
			trace(guiList.concat());
		}
		
		public function drawAll():void
		{
			for (var i:int = 0; i < guiList.length; i++)
			{
				addToStage(guiList[i]);
				guiList[i].draw();
			}
		}
		
		public function addToStage(element:BaseGui):void
		{
			stage.addChild(element);
		}
		
		public function emptyList():void
		{
			trace(guiList.length);
			if (guiList.length != 0)
			{
				while (guiList.length > 0)
				{
					stage.removeChildAt(0);
					//delete guiList[0];
					guiList.shift();
				}
			}
		}
	}
	
}